<?php


namespace app\api\server\notice;


use app\api\model\NoticeModel;
use app\api\ServerBase;
use think\facade\Cache;

class NoticeServer extends ServerBase
{
    protected $request;
    protected $model;
    function __construct($request)
    {
        $this->request=$request;
        $this->model=new NoticeModel();
    }
    function getList()
    {
        [$list, $count] = $this->model->getList(
            $this->request,
            ['status'=>1],
            'id,title',
            1,
            9999);
        $result['data'] = $list;
        $result['count'] = $count;
        $this->getMessageCode('adminMessage.success.select', 2);
        return $result;
    }
    function getDetail()
    {
        $id = $this->request->param('id', 0);
        $res = $this->model->getFindById($id,'id,title,create_time,content');
        $result['data'] = $res;
        $this->getMessageCode('adminMessage.success.select', 2);
        return $result;
    }
}